<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    {% load static %}
    <script src="{% static 'js/jquery.min.js' %}"></script>
    <script src="{% static 'bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>
    <link href="{% static 'bootstrap-3.4.1-dist/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/sweetalert.min.css' %}" rel="stylesheet">
    <script src="{% static 'js/sweetalert.min.js' %}"></script>
    <link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/dashboard.css' %}" rel="stylesheet">
</head>
<body>
<div class="container">
      <form class="form-signin col-md-offset-3" method="post">
        <h2 class="form-signin-heading col-md-offset-3">注册</h2><br/>
        <label for="inputText" class="sr-only">Username</label>
        <input type="text" name="username" id="inputname" class="form-control" style="width: 500px;" placeholder="Username" required autofocus><br/>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" name="password" id="inputPassword" class="form-control" style="width: 500px;" placeholder="Password" required><br/>
          <label for="inputConfirmPassword" class="sr-only">ConfirmPassword</label>
        <input type="password" name="confirmpassword" id="inputConfirmPassword" class="form-control" style="width: 500px;" placeholder="ConfirmPassword" required><br/>
          <label for="teanum" class="sr-only">TeaNum</label>
        <input type="text" name="teanum" id="teanum" class="form-control" style="width: 500px;" placeholder="TeaNum" required>
        <div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> 记住我<br/>
          </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" id="register" style="width: 500px;" type="submit">注册</button>
      </form>
    </div> <!-- /container -->
<script>
    $("#register").click(function () {
        $.ajax({
            url:"",
            type:"post",
            data:{
                "username":$("#inputname").val(),
                "password":$("#inputPassword").val(),
                "confirmpassword":$("#inputConfirmPassword").val(),
                "teanum":$("#teanum").val()
            },
            success:function (e) {
                    if(e.code===200){
                        alert("注册成功")
                    window.location.href="http://127.0.0.1:8000/tea_admin"+e.url
                }else if(e.code===201){
                        alert(e.msg)
                        {#window.location="http://127.0.0.1:8000/tea_admin/tregister/"#}
                    }else {
                        alert(e.msg)
                        {#window.location="http://127.0.0.1:8000/tea_admin/tregister/"#}
                    }
            }
        })
    })
</script>
</body>
</html>